﻿using System;
using Mono.Cecil.Metadata;

namespace Mono.Cecil.Cil
{
	// Token: 0x02000149 RID: 329
	public sealed class EmbeddedSourceDebugInformation : CustomDebugInformation
	{
		// Token: 0x17000331 RID: 817
		// (get) Token: 0x06000C13 RID: 3091 RVA: 0x00035430 File Offset: 0x00033630
		// (set) Token: 0x06000C14 RID: 3092 RVA: 0x0000650C File Offset: 0x0000470C
		public byte[] Content
		{
			get
			{
				bool flag = !this.resolved;
				if (flag)
				{
					this.Resolve();
				}
				return this.content;
			}
			set
			{
				this.content = value;
				this.resolved = true;
			}
		}

		// Token: 0x17000332 RID: 818
		// (get) Token: 0x06000C15 RID: 3093 RVA: 0x0003545C File Offset: 0x0003365C
		// (set) Token: 0x06000C16 RID: 3094 RVA: 0x0000651D File Offset: 0x0000471D
		public bool Compress
		{
			get
			{
				bool flag = !this.resolved;
				if (flag)
				{
					this.Resolve();
				}
				return this.compress;
			}
			set
			{
				this.compress = value;
				this.resolved = true;
			}
		}

		// Token: 0x17000333 RID: 819
		// (get) Token: 0x06000C17 RID: 3095 RVA: 0x00035488 File Offset: 0x00033688
		public override CustomDebugInformationKind Kind
		{
			get
			{
				return CustomDebugInformationKind.EmbeddedSource;
			}
		}

		// Token: 0x06000C18 RID: 3096 RVA: 0x0000652E File Offset: 0x0000472E
		internal EmbeddedSourceDebugInformation(uint index, MetadataReader debug_reader) : base(EmbeddedSourceDebugInformation.KindIdentifier)
		{
			this.index = index;
			this.debug_reader = debug_reader;
		}

		// Token: 0x06000C19 RID: 3097 RVA: 0x0000654B File Offset: 0x0000474B
		public EmbeddedSourceDebugInformation(byte[] content, bool compress) : base(EmbeddedSourceDebugInformation.KindIdentifier)
		{
			this.resolved = true;
			this.content = content;
			this.compress = compress;
		}

		// Token: 0x06000C1A RID: 3098 RVA: 0x0003549C File Offset: 0x0003369C
		internal byte[] ReadRawEmbeddedSourceDebugInformation()
		{
			bool flag = this.debug_reader == null;
			if (flag)
			{
				throw new InvalidOperationException();
			}
			return this.debug_reader.ReadRawEmbeddedSourceDebugInformation(this.index);
		}

		// Token: 0x06000C1B RID: 3099 RVA: 0x000354D4 File Offset: 0x000336D4
		private void Resolve()
		{
			bool flag = this.resolved;
			if (!flag)
			{
				bool flag2 = this.debug_reader == null;
				if (flag2)
				{
					throw new InvalidOperationException();
				}
				Row<byte[], bool> row = this.debug_reader.ReadEmbeddedSourceDebugInformation(this.index);
				this.content = row.Col1;
				this.compress = row.Col2;
				this.resolved = true;
			}
		}

		// Token: 0x04000774 RID: 1908
		internal uint index;

		// Token: 0x04000775 RID: 1909
		internal MetadataReader debug_reader;

		// Token: 0x04000776 RID: 1910
		internal bool resolved;

		// Token: 0x04000777 RID: 1911
		internal byte[] content;

		// Token: 0x04000778 RID: 1912
		internal bool compress;

		// Token: 0x04000779 RID: 1913
		public static Guid KindIdentifier = new Guid("{0E8A571B-6926-466E-B4AD-8AB04611F5FE}");
	}
}
